package test.pcs;

import com.payment.lc.pcs.client.wrap.bo.ProductionAttributes;
import com.payment.lc.pcs.client.wrap.service.ProductionWrapService;
import com.payment.lc.pcs.client.wrap.service.ProductionWrapServiceV20;
import com.payment.lc.pcs.common.enums.BizType;
import com.payment.lc.pcs.common.enums.GroupType;
import com.payment.lc.pcs.common.enums.MiProductCategory;
import com.payment.lc.pcs.service.api.AppSettingService;
import com.payment.lc.pcs.service.api.DynamicDataService;
import com.payment.lc.pcs.service.api.NoticeService;
import com.payment.lc.pcs.service.api.ProductionService;
import com.payment.lc.pcs.service.api.fund.JMFundService;
import com.payment.lc.pcs.service.api.nocache.PcsQueryService;
import com.payment.lc.pcs.service.bo.ProductionSellInfo;
import com.payment.lc.pcs.service.bo.ProductionSellInfoV2;
import com.payment.lc.pcs.service.bo.ProductionValue;
import com.payment.lc.pcs.service.domain.ListWrapper;
import com.payment.lc.pcs.service.domain.Production;
import com.payment.lc.pcs.service.domain.ProductionBizInfo;
import com.payment.lc.pcs.service.request.ProductQueryReq;
import com.payment.lc.pcs.service.response.ProductQueryResp;
import com.payment.lc.pcs.service.util.ProductionItem;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import test.BaseTest;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created on 2016/8/8.
 */
public class Demo3PcsGroupTest1 extends BaseTest {

    @Autowired
    PcsQueryService pcsQueryService;

    @Autowired
    ProductionWrapService productionWrapService;

    @Autowired
    @Qualifier("dynamicDataServiceLocal")
    DynamicDataService dynamicDataServiceLocal;
    @Autowired
    @Qualifier("dynamicDataService")
    DynamicDataService dynamicDataService;

    @Autowired
    JMFundService jmFundService;

    @Autowired
    @Qualifier("productionService")
    ProductionService productionService;

    @Autowired
    @Qualifier("productionServiceLocal")
    ProductionService productionServiceLocal;

    @Autowired
    NoticeService noticeService;
    @Autowired
    AppSettingService appSettingService;
    @Autowired
    ProductionWrapServiceV20 productionWrapServiceV20;

    @Test
    public void test() throws Exception {
        test4();
    }

    void test4() {
        List<Map<String, String>> tip = productionWrapService.getProductTipContents(productionService.getProduction("SU1309"));
        display(tip);
    }
    void test3() {
        ProductQueryReq req = new ProductQueryReq();
        req.setMiCategory(MiProductCategory.YueGuJiao);
        req.setNameOrCode("T");

        ProductQueryResp resp = dynamicDataServiceLocal.queryProducts(req);
        display(resp);
    }
    void test1() {
        String prodCode = "GROUP_SF21";
        ListWrapper<ProductionBizInfo> bizs = productionServiceLocal.getBizs(prodCode);
        display(bizs);
//        Production production = productionServiceLocal.getProduction(prodCode);
//        display(production);
    }

    void test2() {
////        String prodCode = "17220064";
        String prodCode = "GROUP_SF21";
////        String prodCode = "SF2886";
//
//        Production production = productionServiceLocal.getProduction(prodCode);
//        display(prodCode);
//
        ArrayList<String> codes = new ArrayList<>();
        codes.add(prodCode);
        List<Production> productions = productionWrapServiceV20.convertProdCodesIncludeGroupToProductions(codes);
        display(productions);

        List<ProductionItem> productionItems =
                productionWrapServiceV20.getAllOrderedCategoryAndProductions(GroupType.MobileFrontPageGroup);
        display(productionItems);

    }

}